﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'OperarioGetList')
	BEGIN
		DROP  Procedure  OperarioGetList
	END
GO

CREATE PROCEDURE OperarioGetList 	
	(	
		@empresaId AS INT,		
		@id AS VARCHAR(12) = NULL,
		@filtro AS VARCHAR(50) = NULL		
	)	
AS
BEGIN	
	SET NOCOUNT ON
	
	SELECT Id, Nombre
	FROM Lit_Operario
	WHERE EmpresaId = @empresaId	  
	  AND Nombre like '%' + ISNULL(@filtro,'') + '%'
	  AND Id = ISNULL(@Id, Id)  
	ORDER BY Nombre
	
	SET NOCOUNT OFF
END
GO
  